<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../back-common.jsp"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<script type='text/javascript' src="<ls:templateResource item='/resources/common/js/jquery.validate.js'/>" /></script>
<link href="<ls:templateResource item='/resources/plugins/select2-4.0/select2.css'/>" rel="stylesheet"/>
<script src="<ls:templateResource item='/resources/plugins/select2-4.0/select2.full.min.js'/>" type="text/javascript"></script>
<script src="<ls:templateResource item='/resources/plugins/select2-4.0/i18n/zh-CN.js'/>" type="text/javascript"></script>
<script src="<ls:templateResource item='/resources/plugins/select2-4.0/makeSelect2.js'/>" type="text/javascript"></script>
<script src="<ls:templateResource item='/resources/plugins/My97DatePicker/WdatePicker.js'/>" type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="${contextPath}/media/js/jquery.dataTables.min.js"></script>
   <table class="${tableclass}" style="width: 100%">
	   <tr><th>
	          <strong class="am-text-primary am-text-lg">项目管理</strong> /  目标列表 - ${project.name}
	    	</th>
	    </tr>
	</table>   
		    
  <div style="margin-left: 0.5rem">
    <div class="seller_list_title">
        <ul class="seller_title_ul am-tabs-nav am-nav am-nav-tabs">
            <li><i></i><a href="<ls:url address="/admin/project/load/${project.id}"/>">项目信息</a></li>
            <li><i></i><a href="<ls:url address="/admin/projectPlan/query/${project.id}"/>">里程碑</a></li>
            <li class="am-active"><i></i><a href="<ls:url address="/admin/task/query/${project.id}"/>">目标</a></li>
            <li><i></i><a href="<ls:url address="/admin/projectModule/query/${project.id}"/>">模块</a></li>
            <li><i></i><a href="<ls:url address="/admin/projectMember/query/${project.id}"/>">团队</a></li>
            <li><i></i><a href="<ls:url address="/admin/projectReport/query/${project.id}"/>">报表</a></li>
        </ul>
    </div>
  </div>  

    <form id="form1" method="post">
        <table class="${tableclass}" style="min-width: 1000px;">
		    <tbody><tr><td>
		    	    <div align="left" style="padding: 3px;float: left;display:inline-block;width: 100%; overflow: auto;">
				      <input type="hidden" id="curPageNO" name="curPageNO" value="${curPageNO}" />
				       	    
				      <select class="combox ${selectclass}" style="height: 28px" id="moduleId" name="moduleId" requiredTitle="--选择模块--" showNone="false" retUrl="${contextPath}/admin/project/common/loadModules/${projectId}">
				      </select>
				     &nbsp; <input type="text" name="id" maxlength="50" value="${taskQueryDto.id}" size="5" style="height: 28px" placeholder="目标ID"/>
				     &nbsp; <input type="text" name="name" maxlength="50" value="${taskQueryDto.name}" style="height: 28px" placeholder="目标名称"/>
				     
				    <select name="assignedto" id="assignedto" style="width: 120px">
				   	<c:if test="${not empty taskQueryDto.assignedto}">
				   	  <option value="${taskQueryDto.assignedto}">${taskQueryDto.assignedtoRealName}</option>
				   	</c:if>
				   </select>
				   
				   <select name="createBy" id="createBy" style="width: 120px">
				   	<c:if test="${not empty taskQueryDto.createBy}">
				   	  <option value="${taskQueryDto.createBy}">${taskQueryDto.createByRealName}</option>
				   	</c:if>
				   </select>	
				   
				    <select name="finishedby" id="finishedby" style="width: 120px">
				   	<c:if test="${not empty taskQueryDto.finishedby}">
				   	  <option value="${taskQueryDto.finishedby}">${taskQueryDto.finishedbyRealName}</option>
				   	</c:if>
				   </select>
				
				    <select name="canceledby" id="canceledby" style="width: 120px">
				   	<c:if test="${not empty taskQueryDto.canceledby}">
				   	  <option value="${taskQueryDto.canceledby}">${taskQueryDto.canceledbyRealName}</option>
				   	</c:if>
				   </select>   
				   
				    <select name="closedby" id="closedby" style="width: 120px">
				   	<c:if test="${not empty taskQueryDto.closedby}">
				   	  <option value="${taskQueryDto.closedby}">${taskQueryDto.closedbyRealName}</option>
				   	</c:if>
				   </select> 
				   </div>
				   <!-- 第二行 -->
				   <div align="left" style="padding: 3px;float: left;display: inline;">
				   	 <select id="status" name="status" style="height: 28px">
					       <ls:optionGroup type="select" required="false" defaultDisp="--选择状态--" cache="true" beanName="TASK_STATUS" selectedValue="${item.status}" />
					  </select>
				   
				   	 <select id="type" name="type" style="height: 28px">
					    <ls:optionGroup type="select" required="false" cache="true" defaultDisp="--目标类型--"  beanName="TASK_TYPE" selectedValue="${task.type}"/>
		             </select> 
		             
					 <select id="priority" name="priority" style="height: 28px">
						<ls:optionGroup type="select" required="false" defaultDisp="--优先级--" cache="true" beanName="PRIORITY_LEVEL" selectedValue="${task.priority}"/>
		             </select> 
					   
					  <select id="searchTimeMode" name="searchTimeMode" style="height: 28px">
					      <ls:optionGroup type="select" required="true" defaultDisp="--时间模式--" cache="true" beanName="TASK_TIME_MODE" selectedValue="${item.searchTimeMode}" />
					  </select>  
					    
					     从: 
						<input readonly="readonly"  name="startDate" id="startDate" class="Wdate" type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:function(){endDate.focus();},maxDate:'#F{$dp.$D(\'endDate\')}'})" value='<fmt:formatDate value="${taskQueryDto.startDate}" pattern="yyyy-MM-dd"/>' />
						
						到: 
						<input readonly="readonly" name="endDate" id="endDate" class="Wdate" type="text" onClick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'startDate\')}'})" value='<fmt:formatDate value="${taskQueryDto.endDate}" pattern="yyyy-MM-dd"/>' />
					    
					    <input type="submit" value="搜索" class="criteria-btn"/>
					    <input type="button" value="创建" class="criteria-btn" onclick='window.location="<ls:url address='/admin/task/loadByProject/${project.id}'/>"'/>
					   	
					   	<input type="button" value="我的" class="criteria-btn" onclick='window.location="<ls:url address='/admin/task/loadByProject/${project.id}'/>"'/>
					   	
					    <input type="button" value="看板" onclick="window.location='<ls:url address="/admin/task/dashboard/${project.id}"/>'" class="criteria-btn"/>
				    
				    </div>
				  
				</div>
		     </td></tr></tbody>
	    </table>
    </form>
    <div class="container">
			<table id="example" class="${tableclass}" style="width:100%">
				<thead>
					<tr>
						<th>主键</th>
						<th>P</th>
						<th>项目</th>
						<th>目标名称</th>
						<th>状态</th>
						<th>创建</th>
						<th>截止</th>
						<th>指派给</th>
						<th>完成者</th>
						<th>消耗</th>
						<th>剩</th>
						<th>操作</th>
					</tr>
				</thead>

			</table>
	</div>
        <div align="center" id="taskList">
	    </div>
        <script language="JavaScript" type="text/javascript">
			  $(document).ready(function() {
					 //三级联动
			     	 $("select.combox").initSelect();
			
			     	 makeSelect2(contextPath + "/admin/adminUser/userListInTeam/${project.id}","#assignedto","指派给","value","key");
			     	 makeSelect2(contextPath + "/admin/adminUser/userListInTeam/${project.id}","#createBy","由谁建立","value","key");
			     	 makeSelect2(contextPath + "/admin/adminUser/userListInTeam/${project.id}","#finishedby","由谁完成","value","key");  
			     	 makeSelect2(contextPath + "/admin/adminUser/userListInTeam/${project.id}","#canceledby","由谁取消","value","key"); 
			     	 makeSelect2(contextPath + "/admin/adminUser/userListInTeam/${project.id}","#closedby","由谁关闭","value","key"); 
			     	sendData();
			     	 
				    $("#form1").validate({
					submitHandler:function(form){
						sendData();//点击提交按钮触发提交数据
				    }
				    });
				    
					$('#example').DataTable( {
						"processing": false,
						"serverSide": true,
						"ajax": "${contextPath}/admin/task/queryContentData/${project.id}"
					} );
			  });
			  
			  
				function sendData(){
					var formData = $("#form1").serialize();
				     $.ajax({
				    		url:"${contextPath}/admin/task/queryContent/${project.id}", 
				    		type:'post', 
				    		data:formData,
				    		async : true, //默认为true 异步   
				    		error: function(jqXHR, textStatus, errorThrown) {
				    			// alert("系统异常" + " jqXHR= " + jqXHR + ", textStatus = " + textStatus + ",errorThrown =  " + errorThrown);
				    		},
				    		success:function(result){
				    		   $("#taskList").html(result);
				    		}
				    	});
		 }
			
			  function deleteById(id) {
			      if(confirm("  确定删除 ?")){
			            window.location = "<ls:url address='/admin/task/delete/" + id + "'/>";
			        }
			    }
			
			        function pager(curPageNO){
			            document.getElementById("curPageNO").value=curPageNO;
			            sendData();
			        }
			        
		</script>

